package com.linkage.action;

import com.linkage.model.Customer;
import com.linkage.service.ICustomerService;
import com.opensymphony.xwork2.ActionSupport;

public class CustomerAction extends ActionSupport
{
	private ICustomerService customerService;
	private Customer customer;
	
	/**
	 * @return the customer
	 */
	public Customer getCustomer() {
		return customer;
	}

	/**
	 * @param customer the customer to set
	 */
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	/**
	 * @param customerService the customerService to set
	 */
	public void setCustomerService(ICustomerService customerService) {
		this.customerService = customerService;
	}

	/* (non-Javadoc)
	 * @see com.opensymphony.xwork2.ActionSupport#execute()
	 */
	public String execute() throws Exception 
	{
		Customer cust = customer;
		boolean flag = customerService.registerCustomer(customer);
		if (flag)
		{
			return this.SUCCESS;
		}
		else
		{
			return "failure";
		}
	}
	
}
